|
|
|
| 12. Set the RowSource property to datStates. 13. Set the ListField property to szState_desc. 14. Run the project at this point and click the DataCombo box to see a list of state codes in the list portion of the control. |  | Now that you have this combo box loaded with data, you need to synchronize it to the employee data. You want the value in the lState_id field in the Employee table to update the information in the DataCombo control. Also, you want the lState_id in the Employee table to be updated with a new value whenever the user selects a new state from the combo box. |
|
|
| Set the Properties of the DataCombo Box 1. Set the DataSource property of the datcboStates combo box to datEmployees. 2. Set the DataField property to lState_id. 3. Set the BoundColumn property to lState_id. 4. Double-click the datcboStates combo box and add a call to the TextChanged procedure in the Click event. 5. Run the project. You should see the data in the combo box updated as you move to employees in different states. You should also be able to change the data and save that data back to the Employee table. |  | This is an easy way to present information from a foreign key table to the user. This combo box is loaded and will change as you move through the data. |
|
|
|
|
|
|
The data-bound list box (DataList) is used when you want to have a table loaded into a list box automatically by a data control. This cuts down the amount of code you need to write. The DataList control is displayed in the toolbox when you select the Microsoft Data List Controls 6.0 (OLEDB) option from the Components menu. Figure 14.2 shows what this control looks like in the toolbox. |
|
|
|
|
|